The idiomatic expression "to take (or give) someone their/your own medicine," means to treat or deal with others in the same way that they have treated you, or to make them experience the consequences of their actions. It is a response to being wronged or mistreated by another person and it implies taking action against those who harm us or behave unfairly towards us.